package terra.network.packet.server.battle;

import org.jboss.netty.buffer.ChannelBuffer;

import terra.network.packet.Packet;

public class ArrowInfo extends Packet {

	public int oId;
	public float x,y;
	public int w,h;
	public float speed;
	public float gravity;
	public int ownerOId;
	public double angle;

	
	public ArrowInfo() {
	}

	@Override
	public ChannelBuffer toBuffer() {
		ChannelBuffer buf = getNewBuffer();
		buf.writeByte(getId());
		buf.writeInt(oId);
		buf.writeInt(ownerOId);	
		buf.writeInt(w);	
		buf.writeInt(h);
		
		buf.writeFloat(x);
		buf.writeFloat(y);	
		buf.writeFloat(speed);	
		buf.writeFloat(gravity);
		buf.writeDouble(angle);	
		return buf;
	}

	@Override
	public Packet fromBuffer(ChannelBuffer buf) {
		oId = buf.readInt();
		ownerOId = buf.readInt();
		w = buf.readInt();
		h = buf.readInt();
		x = buf.readFloat();
		y = buf.readFloat();
		speed = buf.readFloat();
		gravity = buf.readFloat();
		angle = buf.readDouble();
		return this;
	}

	@Override
	public int getLength() {
		return 41;
	}

	@Override
	public boolean isDynamicLength() {
		return false;
	}

	@Override
	public byte getId() {
		return 22;
	}

	@Override
	public byte getPriority() {
		return PRIOR_HIGH;
	}
}
